Conventionally, a pattern inspection device is known, that inspects whether there is defect or not by comparing a sensor image obtained by taking an image of a mask with a reference image to be a criterion. This method is, for example, disclosed in JP-A-2008-64553.
The pattern inspection device includes an image sensor for taking an image of a mask on which a plurality of contact patterns are formed so as to obtain an sensor image, a reference image forming portion for deploying design data of the mask so as to form the reference image, a difference image preparing portion for preparing difference images between the sensor image and the referential image in the whole of the mask, and a deciding portion for deciding whether there is defect or not based on a gradation value in a part of a region corresponding to the contact pattern of the difference image.
According to the conventional pattern inspection device, there is a problem that if there is a matching residual of alignment in the contact pattern, it can not be differentiated whether the difference of the detected difference image has been caused by the matching residuals or by the shape defect of the mask, so that detection sensitivity can not be enhanced.